{extend name="layout" /}
{block name="content"}
<div class="header-tab header-search" style="top: 0">
    <div class="search-block search-block-small">
        <div class="mui-input-row mui-search tm-flex flex-align-center">
            <input class="" id="keywords" name="keywords" placeholder="请输入优惠券编号" type="text" value="{$couponsno}"/>
            <div class="tm-flex-footer">
                <button class="mui-btn mui-btn-green tm-search-btn" coco-data="func" coco-tag="coupons" coco-url="/v2/coupons/hexiao_list" coco_template="" datafun="get_data">
                    搜索
                </button>
            </div>
        </div>
    </div>
</div>
<div class="mui-content" style="padding-top: 60px;">
    <!-- 切换 -->
    <div class="main-tab-con">
        <div class="" coco-data="{ 'keywords':'{$couponsno}'}" coco-tag="coupons" coco-url="/v2/coupons/hexiao_list" id="coupons-list" template="">
        </div>
        <script id="coupons-tpl" type="text/html">
            {{# layui.each(d.response.list,function(index,item){ }}
            <div class="card-item">
                <div class="tm-flex">
                    <div class="tm-flex-1">
                        <div class="tm-icon-item">
                            {{# if(item.type == 'baoyang'){ }}
                            <div class="fonticon icon-bao">
                            {{# }else if(item.type == 'xubao'){ }}
                            <div class="fonticon icon-xu">
                            {{# }else if(item.type == 'gouche'){ }}
                            <div class="fonticon icon-gou" onclick="layer.msg('提示层', {time: 5000})">
                            {{# }else if(item.type == 'zhihuan'){ }}
                            <div class="fonticon icon-zhi">
                            {{# } }}
                            </div>
                            <div class="tm-icon-label tm-mdx-size">
                                <div class="tm-flex-row">
                                    <span class="uk-text-seccess tm-font-boldx">
                                        {{ item.name }}
                                    </span>
                                </div>
                                <div class="tm-flex-row">
                                    <span class="tm-font-gray">
                                        {{ item.price }}
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tm-flex-foorer uk-text-right">
                        <div class="tm-flex-row">
                            <span class="uk-text-seccess tm-font-boldx">
                                {{ item.couponsno }}
                            </span>
                        </div>
                        <div class="tm-flex-row">
                            <a class="mui-btn mui-btn-yellow" href="javascript:;" coco_ajax confirm="确定要核销该权益吗??？" ajax-url="/v2/coupons/hexiao" ajax-callback="suc_hexiao" ajax-callback-error="error_hexiao" ajax-data="{ mcid:{{ item.id }} }">
                                核销
                            </a>
                            <span class="uk-text-danger" style="display: none;">已使用</span>
                        </div>
                    </div>
                </div>
                {{# if(item.couponsid == 4){ }}
                <div class="card-bd-info tm-font-gray">
                        <div class="tm-flex-row-xs">
                            车主姓名：<span>{{item.carowner}}</span>
                        </div>
                        <div class="tm-flex-row-xs">
                            车主品牌：<span>{{item.brandname}}</span>
                        </div>
                        <div class="tm-flex-row-xs">
                            车牌号：<span>{{item.licenseno}}</span>
                        </div>
                        <div class="tm-flex-row-xs">
                            车架号：<span>{{item.chassisno}}</span>
                        </div>
                </div>
                {{# } }}
                <div class="card-footer">
                    <div class="tm-flex">
                        <div class="tm-flex-1">
                            <span class="tm-font-gray tm-df-size">
                                获取时间：{{ date('Y-m-d', item.addtime ) }}
                            </span>
                        </div>
                        <div class="tm-flex-footer">
                            <span class="tm-font-gray tm-df-size">
                                有效期至：{{ date('Y-m-d', item.endtime ) }}
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            {{# }) }}
        </script>
    </div>
    <!-- 切换 end -->
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    function get_data(obj) {
        var datajson = {};
        datajson.keywords = $("#keywords").val();
        return datajson;
    }
    function suc_hexiao(obj, data) {
        coco_msg("销核成功！");
        $(obj).hide().next().show();
    }
    function error_hexiao(obj,data){
        coco_alert(data.msg);
    }
</script>
{/block}
